home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / diverses / him / hmdemo1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-01  |  3.8 KB  |  131 lines

  1. /***************** Program Source Module ***********************/
  2. #ifdef AUTOPDOC
  3.  
  4. MODULE:     hmdemo1.c
  5.  
  6. DESCRIPTION:
  7.  
  8. Demo program to demonstrate the HIM (tm) Window, Help, and Keyboard Manager
  9. routines.
  10.  
  11. TABLE OF CONTENTS:
  12.  
  13. #endif
  14. /********** Filled by Polytron Version Control System **********
  15.  
  16. $Author:   james borders  $
  17.  
  18. $Date:   01 Dec 1988 12:13:48  $
  19.  
  20. $Revision:   1.1  $
  21.  
  22. $Log:   D:/C/FMLIB/HM/VCS/HMDEMO1.C  $
  23.  * 
  24.  *    Rev 1.1   01 Dec 1988 12:13:48   james borders
  25.  * support for Turbo C
  26.  * 
  27.  *    Rev 1.0   07 May 1988 16:34:54   james borders
  28.  * Initial revision.
  29.  
  30. ****************************************************************/
  31. /*
  32.  *
  33.  *   Copyright 1988  Allsoft (tm)
  34.  *   100 Calle Playa Del Sol NE
  35.  *   Albuquerque, NM  87109
  36.  *
  37.  *   ALL RIGHTS RESERVED.
  38.  *
  39.  *   Unauthorized distribution, adaptation or use may be 
  40.  *   subject to civil and criminal penalties.
  41.  *
  42.  */
  43.  
  44. #include  "stdio.h"              /* standard include file */
  45. #ifdef MSC
  46. #include  "malloc.h"             /* used in lminit and wninit call */
  47. #endif
  48. #ifdef TURBOC
  49. #include  "alloc.h"
  50. #endif
  51. #include  "lm.h"                 /* list manager include file */
  52. #include  "wn.h"                 /* window manager include file */
  53. #include  "km.h"                 /* keyboard manager include file */
  54. #include  "hm.h"                 /* help manager include file */
  55.  
  56. main()
  57. {
  58. int  kbhit(),getch();            /* used in kminit call */
  59. int  wide(), narrow(), multi(), quit();
  60.  
  61. lminit((char *(*)())malloc,free,0);           /* init the list manager */
  62. kminit(kbhit,getch);             /* init the keyboard manager */
  63. wninit(0,0,NULL,0,(char *(*)())malloc,free);  /* init the window manager */
  64. hminit("HELPFILE.HLP",0,
  65.        0,0,WNBLUE,WNCYAN);       /* init the help manager */
  66.  
  67. kmsir(KF1,wide);                 /* register our function key routines */
  68. kmsir(KF2,narrow);
  69. kmsir(KF3,multi);
  70. kmsir(KF10,quit);
  71.  
  72. explain();                       /* tell user how program works */
  73. for (;;)
  74.     kmgetch();                   /* get keys */
  75.  
  76. }
  77.  
  78. explain()
  79. /********/
  80. {
  81. int wnum;
  82.  
  83. wnum = wncreate(2,0,80,22,WNBLACK,WNCYAN,WNBLACK,WNBLUE);
  84. wnttitle(wnum,"[ Helpdemo V1.00  4/4/88 ]");
  85. wnprintf(wnum,"\nA program to demonstrate capabilities of the Window, Keyboard, and ");
  86. wnprintf(wnum,"\nHelp Manager routines contained in the Human Interface Manager (HIM)");
  87. wnprintf(wnum,"\nlibrary.");
  88. wnprintf(wnum,"\n\nThe text in this window is displayed via the Window Manager routine");
  89. wnprintf(wnum,"\nwnprintf().");
  90. wnprintf(wnum,"\n\nThe help text presented by this routine (via F1-F3) is contained");
  91. wnprintf(wnum,"\nin the file HELPFILE.HLP which was built by HFBILDER.EXE from ");
  92. wnprintf(wnum,"\nthe text file HELPFILE.TXT.");
  93. wnprintf(wnum,"\n\nThe 3 routines wide(), narrow(), and multi() have been attached");
  94. wnprintf(wnum,"\nto the f1-f3 keys via the Keyboard Manager.  When these keys");
  95. wnprintf(wnum,"\nare pressed the appropriate routine is called by the Keyboard");
  96. wnprintf(wnum,"\nManager, no switch statement is neccessary.");
  97. wnprintf(wnum,"\n\nF1   to demonstrate wide help text..");
  98. wnprintf(wnum,"\nF2   to demonstrate narrow help text..");
  99. wnprintf(wnum,"\nF3   to demonstrate multi-page help text..");
  100. wnprintf(wnum,"\nF10  to quit program");
  101. }
  102.  
  103. wide()
  104. /*****/
  105. {
  106. hmscontext("wide_help");          /* tells what help to give */
  107. hmhelp();                         /* gives the help */
  108. }
  109.  
  110. narrow()
  111. /*****/
  112. {
  113. hmscontext("narrow_help");        /* tells what help to give */
  114. hmhelp();                         /* gives the help */
  115. }
  116.  
  117. multi()
  118. /*****/
  119. {
  120. hmscontext("multipage_help");     /* tells what help to give */
  121. hmhelp();                         /* gives the help */
  122. }
  123.  
  124. quit()
  125. /*****/
  126. {
  127. wndestroy(-1);                    /* take down all windows */
  128. exit(0);                          /* quit program */
  129. }
  130.  
  131.